<include file="Public:header" />
<div class="subnav">
  <div class="explain-col" style="position: relative; height:24px;">
  	<span class="red">温馨提示：</span>为了避免不小心操作误删导致用户不能正常访问，暂时不开放删除功能。
      <div class="content-menu" style="position: absolute; right: 30px;top: 5px;">
        <a href="javascript:openWinBox('__CONTROLLER__/add','添加')" class="add fb"><em>添加角色</em></a>
      </div>
  </div>
</div>
<!--subnav-->
<div class="pad-lr-10">
  <form name="myform" action="" method="post" id="myform">
    <div class="table-list">
    <table width="100%" cellspacing="0">
      <thead>
        <tr>
          <th align="center" width="50">序号</th>
          <th align="left" width="180">角色名称</th>
          <th align="left">备注</th>
          <th align="center" width="50">状态</th>
          <th align="center" width="100">创建时间</th>
          <th align="center" width="160">操作</th>
        </tr>
      </thead>
      <tbody id="list">
        <volist name="list" id="vo">
          <tr id="list_{$vo.id}">
            <td align="center">{$i}</td>
            <td align="left">{$vo.name}</td>
            <td align="left">{$vo.remark}</td>
            <td align="center">{$vo.status|statusArr}</td>
            <td align="center">{$vo.create_time|date='Y-m-d',###}</td>
            <td align="center">
              <a href="javascript:openWinBox('__CONTROLLER__/add/id/{$vo.id}','编辑');" >【编辑】</a>
              <a href="javascript:del({$vo.id});" >【删除】</a>
            </td>
          </tr>
        </volist>
      </tbody>
    </table>
    <div class="btn"> </div>
  </form>
  <div id="pages">{$page}</div>
</div>
</body>
</html>
<script type="text/javascript">
$(function(){
	$('#myform').ajaxForm({
		beforeSubmit:  checkForm,
		success:       complete,
		dataType: 'json'
	});

	function checkForm(){
		var len = $("input[name='spaceid[]']:checked").length;
		if(len < 1){
			msg('先选择删除项！','warning',4);
			return false;
		}
	}

	var origin = $.artDialog.open.origin;
	function complete(data){
		msg(data.info,data.data);
		if(data.data) setTimeout(function(){origin.location.reload();},1000);
	}
})

function del(id){
  $.get('__CONTROLLER__/del/id/'+id,{},function(data){
    if(data.status==1){
      $("#list_"+id).remove();
    }
  })
}
</script>